home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / UNIXLIB37B / src / c / strtok < prev    next >
Text File  |  1990-09-26  |  560b  |  38 lines

  1. #ifdef __STDC__
  2. static char sccs_id[] = "@(#) strtok.c 1.1 "__DATE__" HJR";
  3. #else
  4. static char sccs_id[] = "@(#) strtok.c 1.1 26/9/90 HJR";
  5. #endif
  6.  
  7. /* strtok.c (c) Copyright 1990 H.Rogers */
  8.  
  9. #ifndef __STDC__
  10. #include "sys/types.h"
  11. #endif
  12. #include <string.h>
  13.  
  14. #ifdef __STDC__
  15. char *strtok(register char *s1,register const char *s2)
  16. #else
  17. char *strtok(s1,s2)
  18. register char *s1;
  19. register const char *s2;
  20. #endif
  21. {
  22. static char *s;
  23.  
  24. if (!s1)
  25.   {
  26.   if (!s)
  27.     return(0);
  28.   else
  29.     s1 = s;
  30.   }
  31.  
  32. s1 += strspn(s1,s2);
  33.  
  34. if (s = strpbrk(s1,s2)) *s++ = 0;
  35.  
  36. return(s1);
  37. }
  38.